﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using SmartMD.DataModel.Entity;
using SmartMD.Manager.Common;
using SmartMD.DataAccess.Service;
using System.Collections.ObjectModel;
using SmartMD.Manager.Utils;
using System.Collections;

namespace SmartMD.Manager.Patient
{
    /// <summary>
    /// Interaction logic for PatientInfoEditPad.xaml
    /// </summary>
    public partial class PatientInfoEditPad : UserControl 
    {
        private Hashtable _cmbHashtable = new Hashtable();

        public PatientInfoEditPad()
        {
            InitializeComponent();
            //this.txtFollowUper.Text = MainWindow.CurrentUser.Name;
        }

        private StoreInfoPanel _ower = null;
        public StoreInfoPanel ower
        {
            set {
                _ower = value;
    //            this._ower.ucToolBar.newHandler = NewPatientInfo;
            }
            get { return _ower; }
        }

        private PatientInfo _dataSource;
        public PatientInfo DataSource
        {
            get
            {
                return _dataSource;
            }
            set
            {
                _dataSource = value;
                this.DataContext = _dataSource;
            }
        }

       
        private void Clear()
        {
            this.txtName.Text = "";
         
            this.txtClinicNo.Text = "";
            this.txtHospitalNo.Text = "";
        }

        private void cmbDiagnose_Initialized(object sender, EventArgs e)
        {
            _cmbHashtable.Add("疾病诊断", sender);
            ComboxUtil.InitializeComboxByDict(sender, "疾病诊断");
        }
        public void InitAllComboxValue()
        {
            string key;
            object sender;
            foreach (DictionaryEntry de in _cmbHashtable)
            {
                key = de.Key.ToString();
                sender = de.Value as object;
                ComboxUtil.InitializeComboxByDict(sender, key);
            }
        }
        private void cmbSex_Initialized(object sender, EventArgs e)
        {
            List<ComboBoxValueItem> datasource = new List<ComboBoxValueItem>();

            datasource.Add(new ComboBoxValueItem { Name = "男", Value = "male" });
            datasource.Add(new ComboBoxValueItem { Name = "女", Value = "female" });
          
            (sender as ComboBox).ItemsSource = datasource;
        }

        private void txtArea_Initialized(object sender, EventArgs e)
        {
            _cmbHashtable.Add("患者地域", sender);
            ComboxUtil.InitializeComboxByDict(sender, "患者地域");
        }

        private void txtBirthDay_TextChanged(object sender, TextChangedEventArgs e)
        {
           /* DateTime birthday = DateTime.Parse(this.txtBirthDay.Text);
            DateTime dateNow = System.DateTime.Now;
            int age = dateNow.Year - birthday.Year + 1;
            this.txtAge.Text = age.ToString();
            * */
        }
      
    }
}
